@tool
class_name PokerSuitTipIcon
extends TextureRect


@export var suit: PokerBullet.PokerSuit:
    set(value):
        suit = value

        var rect: Rect2
        match suit:
            PokerBullet.PokerSuit.SPADE: rect = Rect2(11, 43, 9, 10)
            PokerBullet.PokerSuit.CLUB: rect = Rect2(43, 43, 9, 10)
            PokerBullet.PokerSuit.HEART: rect = Rect2(75, 43, 9, 10)
            PokerBullet.PokerSuit.DIAMOND: rect = Rect2(107, 43, 9, 10)
        
        var atlas := texture as AtlasTexture
        atlas.region = rect

        visible = (not suit == PokerBullet.PokerSuit.NONE)
